<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {
	font-size: 18px;
	font-weight: bold;
}
.style2 {
	font-size: 18px;
	font-style: italic;
	font-weight: bold;
}
.style3 {
	font-size: 24px;
	font-weight: bold;
}
body {
	margin-left: 1cm;
	margin-right: 1cm;
}
.style6 {font-size: 16}
.style9 {font-size: 16; font-style: italic; }
-->
</style>
</head>

<body>
<div align="center">
  <p class="style3">Reference Section</p>
  <p align="left">This section will provide detail about different strategy editor commands that can be used.</p>
  <p align="left">Use ctrl + f to search the reference section of a statement or condition.</p>
  <p align="left"><strong>The Strategy Manager: </strong></p>
  <p align="left"><img src="../images/ManagerRef.JPG" width="287" height="437"></p>
  <div align="left">
    <ol>
      <li> Change version of AMAI currently working on. </li>
        <li>Change race strategies to strategies of another race.</li>
        <li>Edit the racial builds that build no matter what strategy is being used</li>
        <li>Edit the global settings to change a variety of options</li>
        <li>Edit settings of the particular race which provides a variety of options</li>
        <li>Compile your ai</li>
        <li>Create new strategy or profile</li>
        <li>Extract strategy or profile to hard disk</li>
        <li>Insert strategy or profile from hard disk</li>
        <li>Copy strategy or Profile</li>
        <li>Remove strategy or Profile</li>
        <li>Edit strategy or Profile</li>
        <li>Lock computer to selected strategy or profile</li>
        <li>Unlock computers so they use all strategies and profiles again</li>
        <li>Quit</li>
        <li>Window displaying different strategies or profiles</li>
        <li>List strategies of race</li>
        <li>List profiles of current version</li>
        <li>Compiles and optimises the ai scripts so that they are smaller and more effecient.</li>
        <li>Compile the AMAI vs AI version that uses the TFT data to create version allowing you to pit AMAI against the original AI. </li>
    </ol>
  </div>
  <div align="left"></div>
  <p align="left" class="style2">Statements:</p>
  <p align="left"><strong>AddBlock Statement: </strong></p>
  <pre align="left">call AddBlock(<B>1, BLACKSMITH, false, 1, HOUSE, 60</B>)</pre>
  <p align="left">call AddBlock<B>([</B>How many must it build or start to build<B>], [</B>What must it have built or started to build<B>], [</B>Should the first value count started to build(false) or completed build(true)<B>], [</B>How many is it allowed to build before it has to obey the condition stated in the 3 first parameters<B>]</B>,<B>[</B>What is it it is allowed to build this many of at a maximum<B>], [</B>How many game seconds *5 shall pass before this block is turned off<B>])</B></p>
  <p align="left"><strong>AddRBlock Statement:</strong></p>
  <pre align="left">call AddRBlock(<strong>360, 160,0, 0, ANCIENT_WAR, 60</strong>)</pre>
  <p align="left">call AddRBlock(<strong>[</strong>Amount of gold to have more of <strong>], [</strong>Amount of wood to have more of ],[Amount 
  of food to have more of],<strong> [</strong>Cannot build more than this value of unit<strong>], [</strong>Unit type in question<strong>], [</strong>How many seconds * 5 shall pass before this block is turned off<strong>]</strong>)   </p>
  <p align="left"><strong>AddHarass Statement:</strong></p>
  <pre align="left">call AddHarass(<B>1, 2, FOOTMAN</B>)</pre>
  <p align="left">call AddHarass(<strong>[</strong>Harrass group<strong>]</strong>, <strong>[</strong>How many to add to group<strong>]</strong>, <strong>[</strong>What unit type is being added to group<strong>]</strong>)</p>
  <p align="left"><strong>Harass_Target Statement:</strong></p>
  <pre align="left">call Harass(<B>1</B>, <B>HARASS_TARGET_PEONS</B>, <B>true</B>, <B>5</B>, <B>0.25</B>, <B>0</B>, <B>true</B>, <B>50</B>, <B>80</B>)</pre>
  <p align="left">call Harass(<strong>[</strong>Harass group to use<strong>]</strong>, <strong>[</strong>A Harass command<strong>]</strong>, <strong>[</strong> Will it avoid towers (true or false) <strong>], [</strong>It will flee if it encounters strength of this amount<strong>]</strong>,<strong> [</strong>Amount of hp left on units to abort harass<strong>]</strong>, <strong>[</strong>If this many units left abort harass<strong>]</strong>, <strong>[</strong>Any condition to include with harass (leave as true so harass always can run)<strong>]</strong>, <strong>[</strong>Repeat harass this many seconds * 5<strong>]</strong>, <strong>[</strong>Start harass at this many seconds * 5<strong>]</strong>)</p>
  <p align="left"><B>Harass Targets:</B><BR>
    HARASS_TARGET_PEONS - Enemy workers<BR>
HARASS_TARGET_EXPANSION - Enemy expansion<BR>
HARASS_TARGET_MAIN_HALL - Enemy main hall<br>
  HARASS_TARGET_LOCATION - An enemy around a certain location // NOT YET IMPLEMENTED </p>
  <p align="left"><strong>distraction_group Statement:</strong></p>
  <pre align="left">set distraction_group = 2</pre>
  <p align="left">set distraction_group = [Harass group]</p>
  <p align="left">Sets which harass group is used for distractions. These are attacks that occur to confuse enemy to get them to use up a town portal etc. Distraction attacks only occur if you own 3 times the amount of forces needed for the distraction </p>
  <p align="left"><strong>BuiltUnit Statement:</strong></p>
  <pre align="left">call BuildUnit(<B>8, RIFLEMAN, 50</B>)</pre>
  <p align="left">call BuildUnit(<strong>[</strong>Number to build<strong>]</strong>, <strong>[</strong>Unit type to build<strong>], [</strong>End priority<strong>]</strong>)</p>
  <p align="left">Start proity = [End priority] + ([Number to build-1] * 2) </p>
  <p align="left">So this would build 8 rifleman but first one is built with a priority of 64.</p>
  <p align="left"><strong>BuildUpgr Statement:</strong></p>
  <pre align="left">call BuildUpgr(<B>2, UPG_RANGED, 34</B>) </pre>
  <p align="left">call BuildUpgr(<strong>[</strong>Number of time to research<strong>]</strong>, <strong>[</strong>Research Type<strong>]</strong>, <strong>[</strong>End priority<strong>]</strong>)</p>
  <p align="left"><strong>BuildAdvUpgr Statement:</strong></p>
  <pre align="left">call BuildAdvUpgr(1, UPG_BOMBS, 2,TownCountDone(COPTER), 10, 5 ,10)</pre>
  <p align="left"><br> 
  call BuildAdvUpgr([Quantity to build and decides how many versions depending on current tier],  [Research Type],[Start tier],[Count of units], [Maximum number of units to provide the max priority],  [Bonus added to the research prority per tier], [Base prority of upgrade])</p>
  <p align="left">The total priority of the upgrade is equal to the (Base +Tier Bonus) and is only this high once you have the full amount of units. Less and this priority is proportionally less.</p>
  <p align="left">e.g. in example above lets say we have 10 copters we build upgrade at priority 10 at tier 2. If we only have 5 it builds upgrade at priority 5. If we have 0 copters the upgrade will not occur.  </p>
  <p align="left"><strong>basic_melee Statement:</strong></p>
  <pre align="left">call basic_melee(<B>50, 36</B>)</pre>
  <p align="left">call basic_melee(<strong>[</strong>Total food value of knights and footmen<strong>]</strong>, <strong>[</strong>End priority<strong>]</strong>)</p>
  <p align="left">This only works for human races unless you have customly allowed this command to work for other races by changing properties in the racialsettings.txt. </p>
  <p align="left"><strong>DefendTownsDone</strong></p>
  <pre align="center">call DefendTownsDone(2, ANCIENT_PROTECT, 75)
</pre>
  <p align="left">call DefendTownsDone([Number to build], [Unit or building], [priority])</p>
  <p align="left">Will build these amounts of units at all the expansions. <br>
  </p>
  <p align="left"><strong>BuildItem Statement:</strong></p>
  <pre align="left">call BuildItem(<B>2, HEALING_POTION, 40</B>)</pre>
  <p align="left">call BuiltItem(<strong>[</strong>Total items to get<strong>]</strong>, <strong>[</strong>Item type<strong>]</strong>, <strong>[</strong>End priority<strong>]</strong>)</p>
  <p align="left"><strong>Item Names:</strong></p>
  <p align="left"><em>Racial Items</em></p>
  <p align="left">HEALING_POTION<BR>
    MANA_POTION<br>
    TOWN_PORTAL<br>
    LESSER_CLARITY_POTION<br>
    MECHANICAL_CRITTER<br>
    SCROLL_OF_REGENERATION<br>
    ORB_OF_FIRE<br>
    STAFF_OF_SANCTUARY<br>
  HEALING_SALVE<br>
  SCROLL_OF_SPEED<br>
  ORB_OF_LIGHTNING<br>
  TINY_GREAT_HALL<br>
  ROD_OF_NECROMANCY<br>
  SACRIFICIAL_SKULL<br>
  DUST_OF_APPEARANCE<br>
  ORB_OF_CORRUPTION<br>
  SCROLL_OF_HEALING<br>
  MOONSTONE<br>
  STAFF_OF_PRESERVATION<br>
  ORB_OF_VENOM<br>
  ANTI_MAGIC_POTION</p>
  <p align="left"><em>Merchant Items</em><br>
  CIRCLET_OF_NOBILITY<br>
  PERIAPT_OF_VITALITY<br>
  BOOTS_OF_SPEED<br>
  M_DUST_OF_APPEARANCE<br>
  M_SCROLL_OF_HEALING<br>
  SCROLL_OF_PROTECTION<br>
  M_TOWN_PORTAL<br>
  POTION_OF_INVISIBILITY<br>
  TOME_OF_RETRAINING<br>
  STAFF_OF_TELEPORTATION<br>
  POTION_OF_LESSER_INVULNERBILITY</p>
  <p align="left"><strong>SetBuildReact Statement: </strong></p>
  <pre align="left">call SetBuildReact(<B>20, 3, HUNTRESS, 5, ARCHER, enemy_unarmored, 4, 12, 50</B>)</pre>
  <p align="left">call SetBuildReact(<strong>[</strong>Amount of food to spread units over<strong>], [</strong>Build extra number of unit 1 at all times<strong>], [</strong>Unit 1 type to build<strong>], [</strong>Build extra number of unit 2 at all times<strong>], [</strong>Unit 2 type to build<strong>], [</strong>condition to calculate strength<strong>], [</strong>Less than this strength level from condition puts all food as unit 1<strong>], [</strong>More than this strength from condition puts all food at unit 2<strong>], [</strong>Base Priority<strong>]</strong>)<br>
    <br>
  Starting Priority of first unit = Base priority + (Number of Least food unit-1) *2) <br>
  So from above example Starting priority = 50 + (14 *2) = 78 <br>
    This is always the case even if in the above archers no archers was built.  <br>
    <br>
  Both units are built simulationously but unit 1 will always be the first unit to attempt to be built. <br>
  NOTE: If the number to build of a certain unit is 0 amai will not try to build the requirements of that unit. </p>
  <p align="left"><strong>Strength Levels:</strong></p>
  <p align="left">enemy_heavyarmor - Enemy heavy armor strength<BR>
    enemy_lightarmor - Enemy light armor strength<BR>
enemy_mediumarmor - Enemy medium armor strength<BR>
enemy_casters - Enemy casters strength<BR>
enemy_towers - Enemy tower strength<BR>
enemy_unarmored - Enemy unarmored strength<BR>
enemy_magic - Enemy magic attackers strength<BR>
enemy_normal - Enemy normal attackers strength<BR>
enemy_piercing - Enemy piercing attackers strength<BR>
enemy_siege - Enemy siege attackers strength<BR>
enemy_air - Enemy air units strength</p>
  <p align="left"><em><span class="style1">Conditional statements:<br>
    <br>
        <span class="style6">Note:</span></span></em> <span class="style9">You can use any jass native commands in the strategy editor windows. Go to a warcraft site for tutorials of basics of jass as i wont teach you here. </span><em>www.wc3campaigns.net is a good place to find out information. Below is some commonly used conditionaly statements used in the strategy editor. </em></p>
  <p align="left"><strong>TownCountDone condition:</strong></p>
  <pre align="left">TownCountDone(<strong>FOOTMAN</strong>)</pre>
  <p align="left">TownCountDone([unit/building type])</p>
  <p align="left">Counts the number of a certain unit type owned. </p>
  <p align="left">EXAMPLES : If TownCountDone(FOOTMAN) &gt; 5 then</p>
  <p align="left"><strong>Compound conditions:</strong></p>
  <p align="left">This is having more than one condition in place.</p>
  <pre align="left">call SetBuildReact(15, 2, FOOTMAN, 4, RIFLEMAN, <strong>(enemy_unarmored + (enemy_air * 2) + enemy_magic - (enemy_normal * 2))</strong>, 4, 25, 50) </pre>
  <p align="left">You must have brackets around an entire compound condition.</p>
  <p align="left">e.g. if <strong>(</strong>TownCountDone(Footman) + TownCountDone(Rifleman)<strong>)</strong> &gt; 5 then</p>
  <p align="left"><strong>c_enemy Statement:</strong></p>
  <pre align="left">if not (<strong>c_enemy_total </strong>== <strong>c_enemy[R_ELF]</strong>) then</pre>
  <p align="left">c_enemy_total = Total amount of enemy players</p>
  <p align="left">c_enemy[R_ELF] = Total amount of elf race players </p>
  <p align="left">The example statement if the total amount of enemy players does <strong>not </strong>equal the total enemy elf players then.... </p>
  <p align="left"><strong>Min condition:</strong></p>
  <pre align="left">call SetBuildUpgr(<strong>Min</strong>((TownCountDone(FOOTMAN)/5),1), UPG_DEFEND, 70)</pre>
  <p align="left">Min returns the smallest number out of two numbers.<br>
  The above command means if the number of footman / 5 is greater than 1 then do UPG_Defend with priority 70. Therefore 5 footmen or more are needed for this to work. This is basically acting as an if...then statement, but stays all on 1 line.</p>
  <p align="left"><em>NOTE : Becareful when placing your brackets. Its easy to miss them out with this function</em></p>
  <p align="left"><strong>GetPlayerRace condition:</strong></p>
  <pre align="left">GetPlayerRace(<strong>nearest_enemy</strong>) != <strong>RACE_UNDEAD</strong></pre>
  <p align="left">This gets the nearest enemies race. Very useful in harassment calls. != means not equal to.</p>
  <p align="left"><strong>GetPlayerUnitTypeCount condition:</strong></p>
  <pre align="left">GetPlayerUnitTypeCount(<strong>Player(0), ORC_SHIPYARD</strong>) &gt; 0</pre>
  <p align="left">GetPlayerUnitTypeCount(<strong>[</strong>Player Number. Player 0 is player 1<strong>]</strong>, <strong>[</strong>Unit Type to count<strong>]</strong>)</p>
  <p align="left">This counts the number of a unit type owned a specific player. Useful for campaign ai's. </p>
</div>
</body>
</html>
